# Contributor: David Demelier <markand@malikania.fr>
# Maintainer: Saijin-Naib <Saijin-Naib_package-maintenance@outlook.com>
pkgname=ardour
pkgver=7.5.0
pkgrel=2
pkgdesc="professional-grade digital audio workstation"
url="https://ardour.org/"
arch="all !ppc64le" # Does not build on ppc64le.
license="GPL-2.0-or-later AND CC0-1.0 AND MIT"
makedepends="
	alsa-lib-dev
	atkmm-dev
	aubio-dev
	boost-dev
	fftw-dev
	fluidsynth-dev
	gtk+2.0-dev
	gtkmm-dev
	hidapi-dev
	itstool
	jack-dev
	libarchive-dev
	liblo-dev
	libpng-dev
	libsamplerate-dev
	libsigc++-dev
	libsndfile-dev
	lilv-dev
	lrdf-dev
	lv2-dev
	pulseaudio-dev
	python3
	readline-dev
	redland-dev
	rubberband-dev
	serd-dev
	sratom-dev
	suil-dev
	taglib-dev
	vamp-sdk-dev
	"
# the tarballs get randomly removed- ping someone in #alpine-devel to update
# this
source="https://dev.alpinelinux.org/archive/ardour/Ardour-$pkgver.tar.xz
	$pkgname-midi-$pkgver.zip.noauto::https://dev.alpinelinux.org/archive/ardour/ArdourBundledMedia-$pkgver.zip
	"
builddir="$srcdir/Ardour-$pkgver"
ldpath="/usr/lib/ardour7"

build() {
	export LINKFLAGS="$LDFLAGS"
	python3 waf configure \
		--prefix=/usr \
		--cxx11 \
		--keepflags \
		--optimize \
		--freedesktop \
		--no-phone-home \
		--with-backends=pulseaudio,jack,alsa,dummy
		#FIXME: add missing dependencies
		# --use-external-libs
	python3 waf build
}

check() {
	python3 waf test
}

package() {
	python3 waf install --destdir="$pkgdir"

	mkdir -p "$pkgdir"/usr/share/ardour${pkgver%%.*}/media/
	unzip "$srcdir"/$pkgname-midi-$pkgver.zip.noauto \
		-d "$pkgdir"/usr/share/ardour${pkgver%%.*}/media/

	mkdir -p "$pkgdir"/usr/share/metainfo
	mv "$pkgdir"/usr/share/appdata/*.xml "$pkgdir"/usr/share/metainfo
	rmdir "$pkgdir"/usr/share/appdata
}

sha512sums="
5acc2937351cbaf15c365b8543eeb0836f146fab62b2aa36113dceee2f5b4c88fcc8f05612aa683f1c2e985ea4e9ffadc0d411422d1ae6fe2137c0358cb91ed0  Ardour-7.5.0.tar.xz
94b681f989e834f5de25ce87da9c174b11d90617063f8c96147d7eb470391b35f6d54b85de16da8d963cacb01b50d1c1fab0fddd18eb3b086fe17124ecfa4f65  ardour-midi-7.5.0.zip.noauto
"
